﻿#pragma once

#include <memory>
#include <vulkan/vulkan.hpp>

#include "Containers/Vector.h"

class RRenderContext;
class CGPURenderTarget;

class CDefferRenderAttachments
{
public:
    CDefferRenderAttachments(vk::Extent2D InViewportSize);

    vk::Extent2D ViewportSize;

    //format of rendertarget must match the format requirement of attachment
    //so that have to combine different rendertargets into one attachment
    std::shared_ptr<CGPURenderTarget>  AlbedoAndAO ; // eR16G16B16A16Sfloat , RGB is albedo, A is AO
    std::shared_ptr<CGPURenderTarget>  NormalAndRoughness; //eR16G16B16A16Sfloat  , RGB is normal, A is roughness
    std::shared_ptr<CGPURenderTarget>  PositionAndMetalness; //eR16G16B16A16Sfloat , RGB is position, A is metalness
    std::shared_ptr<CGPURenderTarget>  Misc; //eR16G16B16A16Sfloat , R is depth, G is unused, B is unused, A is unused

    //着色输出，但不是最终输出，还需要抗锯齿
    //eR16G16B16A16Sfloat , A 通道无用
    std::shared_ptr<CGPURenderTarget>  ShadeOutput; 
    std::shared_ptr<CGPURenderTarget>  Depth; //eD16Unorm , for depth test only

    vk::Framebuffer FrameBuffer;
    TVector<vk::ClearValue> ClearValues;

    //descriptor set include color attachments
    //used for composite subpass
    vk::DescriptorSet DescriptorSet;

    ~CDefferRenderAttachments();

    void PrepareSelfRecord();

    void CreateDescriptorSet();
};